package com.hdaccp.ch10

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.functions._
object TopNCourseByTypeJob {
  def main(args: Array[String]): Unit = {
    val spark = SparkSession.builder()
      .master("local[2]")
      .appName("A")
      .getOrCreate()
    import spark.implicits._

    //
    val df = spark.read.format("parquet").load("F:\\accp教学\\sparkresources\\cleanlog1")

    df.select("coursetype").groupBy("coursetype").agg(count("coursetype").as("times")).show()


    spark.stop()
  }
}
